{extend name="public/base"}

{block name="x-body"}
<div class="x-body">
    <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" action="{:url('users/user')}">
            <input type="text" name="search_key"  placeholder="会员昵称或手机号" autocomplete="off" class="layui-input" value="{$search_key.search_key}">
            <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
        </form>
    </div>
    <xblock>
        <button class="layui-btn layui-btn-danger" onclick="delAll('{:url(\'users/user_del\')}')"><i class="layui-icon"></i>批量删除</button>
        <button class="layui-btn" onclick="x_admin_show('添加会员','{:url(\'users/user_form\')}')"><i class="layui-icon"></i>添加</button>
        <span class="x-right" style="line-height:40px">共有数据：{$list -> total()} 条</span>
    </xblock>
    <table class="layui-table">
        <thead>
        <tr>
            <th>
                <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
            </th>
            <th>ID</th>
            <th>会员昵称</th>
            <th>会员等级</th>
            <th>累计消费</th>
            <th>剩余积分</th>
            <th>注册日期</th>
            <th width="50" style="text-align: center;">状态</th>
            <th>操作</th>
        </thead>
        <tbody>
        {volist name="list" id="v"}
        <tr>
            <td>
                <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='{$v.id}'><i class="layui-icon">&#xe605;</i></div>
            </td>
            <td>{$v.id}</td>
            <td>{$v.username}</td>
            <td>{$v.level_name}</td>
            <td>{$v.total_amount}</td>
            <td>{$v.integral}</td>
            <td>{$v.reg_time|date="Y-m-d H:i"}</td>
            <td class="td-status">
                <span class="layui-btn layui-btn-normal layui-btn-mini {$v.status ? '' : 'layui-btn-disabled'}">{$v.status ? '已启用' : '未启用'}</span></td>
            <td class="td-manage">
                <a onclick="member_stop(this, '{$v.id}', '{:url(\'users/user_status\')}')" data-status="{$v.status ? 0 : 1}" href="javascript:;"  title="{$v.status ? '停用' : '启用'}">
                    <i class="layui-icon">{$v.status ? '&#xe601;' : '&#xe62f;'}</i>
                </a>
                <a title="编辑"  onclick="x_admin_show('编辑会员', '{:url(\'users/user_form\', [\'id\' => $v.id])}')" href="javascript:;">
                    <i class="layui-icon">&#xe642;</i>
                </a>
                <a title="删除" onclick="member_del(this,'{$v.id}', '{:url(\'users/user_del\')}')" href="javascript:;">
                    <i class="layui-icon">&#xe640;</i>
                </a>
                <a title="查看收货地址" onclick="load_url('{:url(\'users/address\', [\'id\' => $v.id])}')" href="javascript:;">
                    <i class="layui-icon">&#xe674;</i>
                </a>
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div class="page">
        {$list -> render()|raw}
    </div>
</div>
{/block}